import time

from jiu.Base import Base
from selenium.webdriver.common.by import By
class Page(Base):
    # 页面定位
    # 点击登录定位
    click_loc_login=(By.LINK_TEXT,"请登录")
    # 断言1账号登录
    day1=(By.XPATH,'//a[@href="javascript:;"]')
    # 输入用户名定位id="userName"
    username_loc_id=(By.ID,"userName")
    # 输入密码定位id="password"
    password_loc_id=(By.ID,"password")
    # 点击登录定位name="bi_Usuallogin"
    click_log=(By.NAME,'bi_Usuallogin')
    # 点击确定定位class="bindSub"
    click_query_loc=(By.CLASS_NAME,"bindSub")
    # 断言2jxw334934844
    day2=(By.XPATH,"/html/body/div[2]/div/div[1]/div/p/span")
    # 点击我的酒仙网定位href="https://member.jiuxian.com/index.htm"
    click_wojiuxian_loc=(By.XPATH,'//a[@href="https://member.jiuxian.com/index.htm"]')
    # 调用切换页面
    # 下滑800
    # 点击收货地址href="/myaccount/address.htm"
    address_loc=(By.XPATH,'//a[@href="/myaccount/address.htm"]')
    # 输入收货人id="people"
    people_loc=(By.ID,"people")
    # 下拉框定位
    # 1.name = "province"
    beijing_loc=(By.NAME,'province')
    # 2.name="city"
    beijingshi_loc=(By.NAME,'city')
    # 3.name="district"
    diqu_loc=(By.NAME,'district')
    # 输入地址名称id="address"
    address_name_loc=(By.ID,'address')
    # 输入邮政编码id="zipcode"
    zipcode_id=(By.ID,'zipcode')
    # 输入电话id="iphone"
    iphone_id=(By.ID,'iphone')
    # 点击提交class="qjwSubmit2"
    class_tijiao=(By.CLASS_NAME,"qjwSubmit2")
    # 确定class="confirm alertSure"

    # 封装
    def click_login(self):
        self.click(self.click_loc_login)
    # 断言1
    def day11(self):
        self.duanyan(self.day1)
    def username_loc(self):
        self.send_keys(self.username_loc_id,"13485456209")
    def password_loc(self):
        self.send_keys(self.password_loc_id,"123456Aa")
    def click_lo(self):
        self.click(self.click_log)
    def click_query(self):
        self.click(self.click_query_loc)
    def day22(self):
        self.duanyan(self.day2)
    def click_jiuxian(self):
        self.click(self.click_wojiuxian_loc)
    def quehuan(self):
        self.window_to()
    def hua(self):
        self.xiahua(800)
    def address(self):
        self.click(self.address_loc)
    def people_name(self):
        self.send_keys(self.people_loc,"陈景城")
    def beijing(self):
        self.value(self.beijing_loc,"2")
    def beijingshi(self):
        self.text(self.beijingshi_loc,"北京市")
    def diqu(self):
        self.text(self.diqu_loc,"昌平区")
    def address_name(self):
        self.send_keys(self.address_name_loc,"北京市昌平区工商管理学校")
    def  zipcode(self):
        self.send_keys(self.zipcode_id,"102200")
    def iphone(self):
        self.send_keys(self.iphone_id,"13485456209")
    def tijiao(self):
        self.click(self.class_tijiao)
    def tan(self):
        self.tanchaung()



    # 业务逻辑
    def text_01_jiuxian(self):
        self.click_login()
        print(self.day11)
        self.username_loc()
        self.password_loc()
        time.sleep(10)
        self.click_lo()
        self.click_query()
        print(self.day22)
        self.click_jiuxian()
        time.sleep(5)
        self.quehuan()
        time.sleep(2)
        self.hua()
        self.address()
        time.sleep(1)
        self.people_name()
        self.beijing()
        self.beijingshi()
        self.diqu()
        self.address_name()
        self.zipcode()
        self.iphone()
        self.tijiao()
        # self.tan()









